import './ContractComparison.scss'


import { useState } from 'react';
import { Result, Button } from 'antd'
import { drawerStore } from '../../Config/zustand'
import { useEventEmitter } from 'ahooks';

const ImageUrl = window.sessionStorage.getItem('IMAGE')
const ContractComparison = () => {
    const { updateDrawer } = drawerStore()
    const [visible, setVisible] = useState(false)

    const onSelect = () => {

        updateDrawer({
            type: 'AddFormData',
            width: 480,
            title: '模板与合同选择',
            data: { type: 'ContractComparison', AddEvnet }
        })
    }

    const AddEvnet = useEventEmitter()
    AddEvnet.useSubscription(val => {
        const { type, data } = val
        if (type === 'onFormBack') {
            console.log(data)
            AddEvnet.emit({ type: 'closeForm' })
        }
    })

    return (
        <div className='ContractComparison'>
            {visible ?
                '对比结果' :
                <Result
                    title="请选择要对比的合同"
                    icon={<img src={ImageUrl + 'AIRobot.png'} />}
                    extra={<Button type="primary" key="console" onClick={onSelect}> 选择合同 </Button>}
                />
            }
        </div>
    );
};



export default ContractComparison;